package frsf.cidisi.exercise.proyectoia.search;

import frsf.cidisi.faia.solver.search.IEstimatedCostFunction;
import frsf.cidisi.faia.solver.search.NTree;

/**
 * This class allows to define a function to be used by any
 * informed search strategy, like A Star or Greedy.
 */
public class Heuristic implements IEstimatedCostFunction {

    /**
     * It returns the estimated cost to reach the goal from a NTree node.
     */
    @Override
    public double getEstimatedCost(NTree node) {
        StateDrone agState = (StateDrone) node.getAgentState();
        
        if(node.getAction().toString()== "SacarFoto")
    		return 0;
        else{
	        switch(agState.getNivel()) {
	        	case 1: 
	        		int intensidadM = 2*agState.getCuadranteMedio().getIntensidad();
	        		return -intensidadM;
	        	
	        	case 2:
	        		int intensidadB = agState.getCuadranteBajo().getIntensidad();
	        		return -intensidadB;
	        		
	        	case 3:
	        		int personasE = 20*agState.getEsquinaActual().getCantidadPersonas();
	        		return -personasE;
	        }
	        
			return 0; 
	    }
    }
}
